﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using WPFExcelReport.Helpers;
using System.ComponentModel;
namespace WPFExcelReport
{
    public partial class TGS07:UIGSC
    { 
       
        public TGS07()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VGSCOLOR();
            DataContext = MV;           
            InitializeComponent(); 
        }
        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);
            if(dwMaster==null)
            {
                DES = "";
            }
            else
            {
                DES = TMV.GSCBEZ;
            }
        }
        public override void LOADBYAUF()
        {
            TBMain.Clear();
            if (ORDERNUM.Length < 33)
                return;
            dwData = TBMain.NewRow();
            dwData["GSCMANDANT"] = app.Mandant;
            dwData["GSCART"] = ORDERNUM.Substring(1, 20);
            dwData["GSCVAR"] = ORDERNUM.Substring(21, 3);
            dwData["GSCFARBE"] = ORDERNUM.Substring(24, 10);
            SResult = TMV.QGC01(dwData);
            MergeData(SResult, true);
            base.LOADBYAUF();
        }
        public override void OnSave()
        {

            if (!IsSaved)
                return;
            if (dwMaster == null)
                return;
            TMV.UpdateGSCOLOR(dwMaster, 0);
            string key = KEY;
            KEY = "";
            KEY = key;
            base.OnSave();
        }
        public override void OnDESChg(string des)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.GSCBEZ = DES;
            base.OnDESChg(des);
        }
    }
}
